//
// Created by root on 4/29/17.
//

#include "../runner_scheme.h"

static void test_op_car() {
    assert_string_equal(interpret("(car '(1 2 3))"), "1");
}

static void test_op_cdr() {
    assert_string_equal(interpret("(cdr '(1 2 3))"), "(2 3)");
}

static void test_op_cons() {
    assert_string_equal(interpret("(cons 1 2)"), "(1 . 2)");
}

static void test_op_setcar() {
    assert_string_equal(interpret("(set-car! '(1 2 3) 5)"), "(5 2 3)");
}

static void test_op_setcdr() {
    assert_string_equal(interpret("(set-cdr! '(1 2 3) 5)"), "(1 . 5)");
}

int main(int argc, char **argv) {
    const struct CMUnitTest tests[] = {
            cmocka_unit_test(test_op_car),
            cmocka_unit_test(test_op_cdr),
            cmocka_unit_test(test_op_cons),
            cmocka_unit_test(test_op_setcar),
            cmocka_unit_test(test_op_setcdr),
    };
    return cmocka_run_group_tests(tests, setup_scheme, teardown_scheme);
}
